﻿<%@ Page Language="C#" MasterPageFile="~/Game/Game.Master" AutoEventWireup="true" CodeBehind="Fleets.aspx.cs" Inherits="smallDeimos.Game.Fleets" Title="Small Deimos - Fleets" %>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    Fleets in transit:
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="True" 
        DataSourceID="FleetsInTransit" AllowSorting="True">
        <EmptyDataTemplate>
            No fleets in transit.
        </EmptyDataTemplate>
    </asp:GridView>
    <asp:SqlDataSource ID="FleetsInTransit" runat="server" 
        ConnectionString="<%$ ConnectionStrings:smallDeimosConnectionString %>" 
        
    SelectCommand="SELECT ColonyShips, Transports, Crusiers, Destroyers, Battleships, FromSystem, FromPlanet, ToPlanet, ToSystem, DATEADD(hour, (SELECT TimeZone FROM Players WHERE (PlayerId = @OwnerID)), ArrivialTime) AS Time FROM Fleets WHERE (OwnerID = @OwnerID) ORDER BY Time DESC">
        <SelectParameters>
            <asp:CookieParameter CookieName="sd_id" Name="OwnerID" />
        </SelectParameters>
    </asp:SqlDataSource>
Fleets on planets:<br />
&nbsp;<asp:Label ID="Label1" runat="server"></asp:Label>
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" DataSourceID="FleetsOnPlanets" 
        onselectedindexchanged="GridView2_SelectedIndexChanged" 
        AllowSorting="True" Width="777px" 
    onrowdatabound="GridView2_RowDataBound">
        <Columns>
            <asp:BoundField DataField="SystemID" HeaderText="SystemID" ReadOnly="True" 
                SortExpression="SystemID">
                <ItemStyle Width="1px" />
            </asp:BoundField>
            <asp:BoundField DataField="Expr1" HeaderText="System" SortExpression="Expr1">
                <ItemStyle Width="150px" />
            </asp:BoundField>
            <asp:BoundField DataField="ColonyShips" HeaderText="Colony ships" 
                SortExpression="ColonyShips" />
            <asp:BoundField DataField="Transports" HeaderText="Transports" 
                SortExpression="Transports" />
            <asp:BoundField DataField="Destroyers" HeaderText="Destroyers" 
                SortExpression="Destroyers" />
            <asp:BoundField DataField="Cruisers" HeaderText="Cruisers" 
                SortExpression="Cruisers" />
            <asp:BoundField DataField="Battleships" HeaderText="Battleships" 
                SortExpression="Battleships" />
            <asp:HyperLinkField DataNavigateUrlFields="SystemId,PlanetId" 
                DataNavigateUrlFormatString="FleetView.aspx?sId={0}&amp;pId={1}" 
                Text="Launch" />
        </Columns>
        <EmptyDataTemplate>
            You don&#39;t have fleets.
        </EmptyDataTemplate>
    </asp:GridView>
    <asp:SqlDataSource ID="FleetsOnPlanets" runat="server" 
        ConnectionString="<%$ ConnectionStrings:smallDeimosConnectionString %>" 
        
        
        
        SelectCommand="SELECT Planets.SystemID, Planets.PlanetID, CAST(Planets.ColonyShips AS int) AS ColonyShips, CAST(Planets.Transports AS int) AS Transports, CAST(Planets.Destroyers AS int) AS Destroyers, CAST(Planets.Battleships AS int) AS Battleships, CAST(Planets.Crusiers AS int) AS Cruisers, Systems.SystemName + ' #' + CAST(Planets.PlanetID AS nvarchar) AS Expr1 FROM Planets INNER JOIN Systems ON Planets.SystemID = Systems.SystemID WHERE (Planets.FleetOwnerID = @oId) AND (CAST(Planets.ColonyShips AS int) + CAST(Planets.Transports AS int) + CAST(Planets.Destroyers AS int) + CAST(Planets.Battleships AS int) + CAST(Planets.Crusiers AS int) &gt; 0) OR (Planets.FleetOwnerID = 0) AND (CAST(Planets.ColonyShips AS int) + CAST(Planets.Transports AS int) + CAST(Planets.Destroyers AS int) + CAST(Planets.Battleships AS int) + CAST(Planets.Crusiers AS int) &gt; 0) AND (Planets.OwnerID = @oId)">
        <SelectParameters>
            <asp:CookieParameter CookieName="sd_id" Name="oId" />
        </SelectParameters>
    </asp:SqlDataSource>

</asp:Content>
